package jp.ne.hatena.d.digitalsoul.warikan.pages

import java.util._

import org.apache.wicket.markup.html._
import org.apache.wicket.markup.html.basic._
import org.apache.wicket.markup.html.form._
import org.apache.wicket.markup.html.list._
import org.apache.wicket.model._

import jp.ne.hatena.d.digitalsoul.warikan.actions._
import jp.ne.hatena.d.digitalsoul.warikan.pages.forms._
import jp.ne.hatena.d.digitalsoul.warikan.pages.items._

class SlopeListPage extends WebPage {
	
	val action = new SlopeListAction
	
    var slopeListItems = action.createSlopeListItems
	
    val main = new Form("main")
    add(main)
    
	// table:slopes
	val slopeList = new ListView[SlopeListItem]("slopes", slopeListItems) {
		override def populateItem(listItem:ListItem[SlopeListItem]) = {
			listItem.setModel(new CompoundPropertyModel(listItem.getModelObject))
			listItem.add(new Label("slopeId"))
			listItem.add(new Label("slopeName"))
		}
	}
	main.add(slopeList)
	
	// button:newSlopeButton
	val newSlopeButton = new Button("newSlopeButton") {
		override def onSubmit = {
			setResponsePage(new SlopeDetailPage)
		}
	}
	main.add(newSlopeButton)
	
	// button:Back
    val backButton = new Button("backButton") {
    	override def onSubmit = {
    		setResponsePage(new TopPage)
    	}
    }
    main.add(backButton)

}